package com.gitee.wsl.collections.map


/**
 * A `Map` implementation that is a general purpose alternative
 * to `HashMap`.
 *
 *
 * This implementation improves on the JDK1.4 HashMap by adding the
 * [MapIterator][org.apache.commons.collections4.MapIterator]
 * functionality and many methods for subclassing.
 *
 *
 *
 * **Note that HashedMap is not synchronized and is not thread-safe.**
 * If you wish to use this map from multiple threads concurrently, you must use
 * appropriate synchronization. The simplest approach is to wrap this map
 * using [java.util.Collections.synchronizedMap]. This class may throw
 * exceptions when accessed by concurrent threads without synchronization.
 *
 *
 * @param <K> the type of the keys in this map
 * @param <V> the type of the values in this map
 * @since 3.0
</V></K> */
class HashedMap<K, V> : AbstractHashedMap<K, V>{
    /**
     * Constructs a new empty map with default size and load factor.
     */
    constructor() : super(DEFAULT_CAPACITY, DEFAULT_LOAD_FACTOR, DEFAULT_THRESHOLD)

    /**
     * Constructs a new, empty map with the specified initial capacity.
     *
     * @param initialCapacity  the initial capacity
     * @throws IllegalArgumentException if the initial capacity is negative
     */
    constructor(initialCapacity: Int) : super(initialCapacity)

    /**
     * Constructs a new, empty map with the specified initial capacity and
     * load factor.
     *
     * @param initialCapacity  the initial capacity
     * @param loadFactor  the load factor
     * @throws IllegalArgumentException if the initial capacity is negative
     * @throws IllegalArgumentException if the load factor is less than zero
     */
    constructor(initialCapacity: Int, loadFactor: Float) : super(initialCapacity, loadFactor)

    /**
     * Constructor copying elements from another map.
     *
     * @param map  the map to copy
     * @throws NullPointerException if the map is null
     */
    constructor(map: Map< K,V>) : super(map)

    /**
     * Clones the map without cloning the keys or values.
     *
     * @return a shallow clone
     */
//    public override fun clone(): HashedMap<K?, V?>? {
//        return super.clone() as HashedMap<K?, V?>?
//    }

    /**
     * Deserializes the map in using a custom routine.
     *
     * @param in the input stream
     * @throws IOException if an error occurs while reading from the stream
     * @throws ClassNotFoundException if an object read from the stream cannot be loaded
     */
//    @Throws(IOException::class, java.lang.ClassNotFoundException::class)
//    private fun readObject(`in`: ObjectInputStream) {
//        `in`.defaultReadObject()
//        doReadObject(`in`)
//    }

    /**
     * Serializes this object to an ObjectOutputStream.
     *
     * @param out the target ObjectOutputStream.
     * @throws IOException thrown when an I/O errors occur writing to the target stream.
     */
//    @Throws(IOException::class)
//    private fun writeObject(out: ObjectOutputStream) {
//        out.defaultWriteObject()
//        doWriteObject(out)
//    }

}
